<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
  </head>
  
  <body>
    <!-- <form onsubmit="send()">
        <div>
            <label for="user">账号</label>
            <input type="text" id="user">
        </div>

        <div>
            <label for="password">密码</label>
            <input type="text" id="password">
        </div>

        
    </form> -->
    <button id="btn">提交</button>

    <script>
      function send(e, a, b) {
        console.log(this, "按钮点击", e);
        let a = undefined
      }

      let btn = document.getElementById("btn");
      btn.addEventListener("click", debounce(send, 1000));

      function debounce(fn, delay) {
        let timer;

        return function () {
          //arguments
          // let _this = this
          let args = arguments;
          if (timer) clearTimeout(timer);

          timer = setTimeout(() => {
            fn.call(this, ...args);
          }, delay);
        };
      }
    </script>
  </body>
</html>
